<!DOCTYPE html>
<html>
    <head>
        <title>7ParadigmJips</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link href="../css/bootstrap.css" rel="stylesheet">
        <link href="../css/bootstrap-responsive.css" rel="stylesheet">
        <link href="../css/index-style.css" rel="stylesheet">
        <style type="text/css">
            #form-signin{
                margin-top: 200px;
                margin-left: 0px;
                padding-top: 50px;
                background: #fff;
                width: 100%;
                height: 200px;
                border-radius: 5px;
            }
            @media(max-width: 767px){
                #form-signin{
                    padding-left: 20px;
                }
            }
            .container-fluid{
                width: 100%;
                margin-left: -20px;
            }
        </style>
    </head>
    <body>
        <?php
        include_once 'paradigmShift/UTcheckAuth.php';
        if (isset($_POST['login'])) {
            session_start();
            $userName = $_POST['userName'];
            $userPass = $_POST['password'];
            $successCode = 21; //terence

            $result = checkAuthentication($userName, $userPass);
            if ($result == $successCode) {
                $_SESSION['userName'] = $userName;
                $_SESSION['userPassHash'] = $userPass;
                $_SESSION['lastLogin'] = mktime(
                        date("H"), date("i"), date("s"), date("m"), date("d"), date("Y")
                );
                header("Location: main.php");
            } else {
                echo("Invalid User Name or Password!");
            }
        }
        ?>
        <div class="container-fluid">
            <div class="row-fluid" id="form-signin">
                <div class="span2 offset1 hidden-phone" id="title" style="border-right: #000 solid thin; height: 150px;">
                    Welcome to 7ParadigmJips
                </div>
                <div class="span9">
                    <div class="row-fluid">
                        <div class="span6">
                            <form action="" method="post">
                                <div class="controls">
                                    <input id="userName" type="text" name="userName" placeholder="User Name" required />
                                </div>
                                <div class="controls">
                                    <input id="password" name="password" type="password" placeholder="Password" required />
                                </div>
                                <div class="controls">
                                    <input type="submit" name="login" value="Login" class="btn btn-primary btn-large" />
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </body>
</html>
